<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>通过class属性查找</title>
</head>
<body>
<div>
	<p class="fish">草鱼</p>
	<p class="fish">草鱼</p>
	<p class="fish">草鱼</p>
	<span id="app" class="fields">看来季后赛得分手段</span>	

</div>
<script type="text/javascript">
// 1、dom对象。属性名
var radios = document.getElementsByClassName('fish');
radios[0].id = 'red';
// 2、通过对象方法  setAttribute getAttribute removeAttribute
var app = document.getElementById('app');
// console.log(app);
var attr = app.getAttribute('class');
console.log(attr);
// 设置与修改属性
app.setAttribute('class','first');
// 删除属性
app.removeAttribute('class');
// 操作文本内容 innerText
radios[1].innerText = '<em>jlkasdjfa;lfj</em>'



// 操作里面html子标签（解析内容里面的div标签） innerHTML
radios[2].innerHTML = '<span>jlkasdjfa;lfj<div>流口水的</div></span>'

</script>
</body>
</html>